package cn.itsource.controller;

import cn.itsource.bean.Employee;
import cn.itsource.bean.User;
import cn.itsource.service.IEmployeeService;
import cn.itsource.service.IUserService;
import cn.itsource.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : 张金铭
 * @description :登入控制层
 * @create :2022-11-17 10:55:00
 */
@Slf4j
@RestController
@RequestMapping("/system")
public class LoginController {

    @Resource
    private IEmployeeService employeeService;

    @Resource
    private IUserService userService;


    @PostMapping("/login")
    public JsonResult empLogin(@RequestBody Employee employee){
//        log.info("用户账号{}，用户密码{}",employee.getUsername(),employee.getPassword());
        return employeeService.login(employee);
    }

    @PostMapping("/userLogin")
    public JsonResult userLogin(@RequestBody User user){
        return userService.login(user);
    }


}
